//
//  VisitorLoginView.swift
//  DLCjingling
//
//  Created by 顿理超 on 16/5/8.
//  Copyright © 2016年 顿理超. All rights reserved.
//

import UIKit

class VisitorLoginView: UIView {

    @IBOutlet weak var samllIconView: UIImageView!
    
    @IBOutlet weak var IconView: UIImageView!
    
    @IBOutlet weak var messageLabel: UILabel!
    
    func setupInfo (imageName: String , message: String ,isHome: Bool = false ){
        
        IconView.hidden = !isHome
        
        if isHome  {
        IconView.image = UIImage(named: imageName)
        } else {
        samllIconView.image = UIImage(named: imageName)
        }
        messageLabel.text = message
        
//        if isHome {
//        startAnimation()
//        }else {
//        stopAnimation()
//        }
        isHome ? startAnimation() : stopAnimation()
    }
    
    func startAnimation (){
        let anim = CABasicAnimation(keyPath:"transform.rotation")
        anim.toValue = 2 * M_PI
        anim.repeatCount = MAXFLOAT
        anim.duration = 20
        
        
        samllIconView.layer.addAnimation(anim, forKey: nil)
    }
    func stopAnimation (){
        samllIconView.layer.removeAllAnimations()
    }
    
    
    @IBAction func register() {
    }
    @IBAction func login() {
    }
    
    /*
    // Only override drawRect: if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func drawRect(rect: CGRect) {
        // Drawing code
    }
    */

}
